//
//  RootTabBarViewController.m
//  Demo
//
//  Created by 拓客营 on 2022/3/24.
//

#import "RootTabBarViewController.h"
#import "RootTabBarViewController+UISet.h"

@interface RootTabBarViewController ()<UITabBarControllerDelegate>

@end

@implementation RootTabBarViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self initialControllers];
}

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    
    self.delegate = self;
    self.tabBar.backgroundColor = [UIColor whiteColor];
    
    [[UITabBar appearance] setTranslucent:NO];
}

#pragma mark -- UITabBarControllerDelegate
- (BOOL)tabBarController:(UITabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController
{
    UIViewController *selectedViewController = viewController;
    
    if ([viewController isKindOfClass:[BaseNavigationController class]]) {

        BaseNavigationController *navi = (BaseNavigationController *)viewController;
        selectedViewController = [navi.viewControllers firstObject];
    }
    
    return YES;
}

@end
